package com.jy.rhin.infra.repo.document.submission.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jy.rhin.infra.repo.document.submission.po.DocumentValidateResultPO;
import com.jy.rhin.sdk.dto.tongji.WenDangZLFXDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface DocumentValidateResultMapper extends BaseMapper<DocumentValidateResultPO> {

    @Select("select * from t_document_validate_result ${ew.customSqlSegment}")
    Page<DocumentValidateResultPO> page(Page<DocumentValidateResultPO> page,@Param(Constants.WRAPPER) QueryWrapper<DocumentValidateResultPO> queryWrapper);

    @Select({"<script>select document_type wenDangMC,count(*) wenDangZL from t_document_validate_result where 1=1 " +
            " <if test='kaiShiRQ!=null and kaiShiRQ!=\"\"'> and document_create_time &gt;= #{kaiShiRQ} </if>",
            " <if test='jieShuRQ!=null and jieShuRQ!=\"\"'> and document_create_time &lt;= #{jieShuRQ} </if>",
            " group by document_type </script>"})
    List<WenDangZLFXDto> getwenDangZBFXList(@Param("kaiShiRQ") String kaiShiRQ,@Param("jieShuRQ") String jieShuRQ);

}
